#ifndef UCONTROL
#define UCONTROL
#include "../stdafx.h"

class TControl
{
private:
	bool HasFocus;
protected:
	int Left, Top, Right, Bottom;
	bool IsFocussed();
	bool LastClickWasOurs;
	bool MouseOver;
	int LastMX, LastMY; //Last mouse positions on this control
public:
	bool Contains(int X, int Y);
	TRectangle BoundsRect();

	TControl(TRectangle rect);

	virtual void Draw() = 0;
	virtual void MouseMove	(int X, int Y, int mstate);
	virtual void MouseDown	(int X, int Y, uint8 button);
	virtual void MouseUp	(int X, int Y, uint8 button);
	virtual void MouseClick(); //called on mouse down, mouse up without an other mouse down on an other control
	virtual void MouseLeave	();
	virtual void KeyDown	(SDL_KeyboardEvent* Key);
	virtual void KeyUp		(SDL_KeyboardEvent* Key);

	virtual void setFocus(bool focus);
	virtual void setPos(TRectangle rect);

	bool visible;

};

#endif
